package com.coolingme.ticket;

import java.util.Random;

/**
 * 火车票
 *
 * @author wangyue
 * @date 2020-09-16 22:58
 */
public class TrainTicket implements ITicket {

    private String from;

    private String to;

    private int price;

    public TrainTicket(String from, String to) {
        this.from = from;
        this.to = to;
    }

    @Override
    public void showInfo(String bunk) {
        this.price = new Random().nextInt(100);
        System.out.println(String.format("%s -> %s : %s 价格为 %s", this.from, this.to, bunk, this.price));
    }
}
